﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyManager.Business
{
    public class CategoryManager
    {
        private ICategoryDataManager _categoryDataManager;

        public CategoryManager(ICategoryDataManager categoryManager)
        {
            this._categoryDataManager = categoryManager;
        }

        public Category Create(string name, string parentCategoryId)
        {
            return this._categoryDataManager.Create(new Category(name, parentCategoryId));
        }

        public Category Create(string name, Category parentCategory)
        {
            return this._categoryDataManager.Create(new Category(name, parentCategory.Id));
        }

        public Category Create(Category category)
        {
            return this._categoryDataManager.Create(category);
        }

        public Category Create(Category category, string parentCategoryId)
        {
            category.ParentCategoryId = parentCategoryId;
            return this._categoryDataManager.Create(category);
        }

        public Category Create(Category category, Category parentCategory)
        {
            category.ParentCategoryId = parentCategory.Id;
            return this._categoryDataManager.Create(category);
        }

        //TODO: Update and delete methods


        public CategoryCollection GetAllCategories()
        {
            return this._categoryDataManager.GetAllCategories();
        }



        public CategoryCollection GetChildCategories(string parentCategoryId)
        {
            return this._categoryDataManager.GetChildCategories(parentCategoryId);
        }

        public CategoryCollection GetChildCategories(Category parentCategory)
        {
            return this._categoryDataManager.GetChildCategories(parentCategory.Id);
        }

        public Category GetCategoryById(string categoryId)
        {
            return this._categoryDataManager.GetCategoryById(categoryId);
        }

        public CategoryCollection GetCategoriesByName(string categoryName)
        {
            return this._categoryDataManager.GetCategoriesByName(categoryName);
        }

        public CategoryCollection GetCategoriesById(StringCollection categoryIds)
        {
            return this._categoryDataManager.GetCategoriesById(categoryIds);
        }





    }
}
